﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Insert_Customer : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    public void AddCustomer(object s, EventArgs e)
    {

        Customer c = new Customer();
        CustomerBOL cBOL = new CustomerBOL();

        try
        {
            c.Identification = txtIdentification.Text;
            c.Firstname = txtFirstName.Text;
            c.Lastname = txtLastName.Text;
            c.Age = Convert.ToInt32(txtAge.Text);
            c.Address = txtAddress.Text;
            c.Phonenumber = txtPhonenumber.Text;
            c.Email = txtEmail.Text;

            int result = cBOL.insertCustomer(c);
            if (result > 0)
            {
                LResult.Text = "Insert record is successful!";
            }
            else
                LResult.Text = "Insert record is error";
        }
        catch (Exception ex)
        {
            LResult.Text = ex.Message;
        }
        finally
        {
            c = null;
            cBOL = null;
        }
    }
}